package com.itheima.tanhua.dubbo.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.itheima.tanhua.dubbo.mappers.TanhuaMapper;
import com.itheima.tanhua.dubbo.service.TanhuaService;
import com.itheima.tanhua.model.domain.UserInfo;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * @author H Monster
 */
@DubboService
public class TanhuaServiceImpl implements TanhuaService {
    @Autowired
    private TanhuaMapper tanhuaMapper;

    @Override
    public UserInfo randomUserByCity(String userId, String city) {
        return tanhuaMapper.randomUserByCity(userId, city);
    }

    @Override
    public Long countRecommendList(String userId, String city) {
        return tanhuaMapper.countRecommendList(userId, city);
    }

    @Override
    public List<UserInfo> getUserInfoInIds(List<String> idList) {
        if (CollUtil.isEmpty(idList)){
            return new ArrayList<>();
        }
        return tanhuaMapper.getUserInfoInIds(idList);
    }
}
